﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.MemoryMappedFiles;
using System.IO;

namespace PositionalIndexer
{
    public static class WARCFile
    {
        public static StreamReader ReadFile(String filepath)
        {
            MemoryMappedFile mmf = MemoryMappedFile.CreateFromFile(filepath);
            MemoryMappedViewStream mmfStream = mmf.CreateViewStream();
            StreamReader sr = new StreamReader(mmfStream, Encoding.UTF8);
            return sr;
        }

        public static void WriteFile(string filepath, string text)
        {
            StreamWriter streamWriter = new StreamWriter(filepath, false, Encoding.UTF8);
            streamWriter.WriteLine(text);
            streamWriter.Close();
        }
    }
}